<?php
import("data.db.DbAbstractTable");
import("data.db.DbAbstractForeign");
import("data.db.DbFactory");

class DbIssueItem extends DbAbstractTable {
	
	public $className = "data.logic.content.IssueItem";
	const CLASS_NAME = "data.logic.content.IssueItem";
	//
	// SQL Table description section
	//
	const TB_TABLENAME	= "pd_issue_item";
	const TB_I			= 'issi';
	
	const TB_O_CLASS	= 'issi_obj_class';
	const TB_O_ID		= 'issi_obj_id';
	const TB_ORDER		= 'issi_order';
	
	public static function _get_TABLENAME() {return self::TB_TABLENAME;}
	public static function _get_ID() {return self::TB_I."_id";}
	public static function _get_SUFFIX() {return self::TB_I;}
	//
	//
	function forwardForeignCollection() {
		return array("Issue"=>"data.logic.content.Issue");
	}
	
	// properties
	public $obj_class;
	public $obj_id;
	public $order;
	
	public function __construct($noinit=false) {
		parent::__construct($noinit);
	}
	
	function getObjClass() {
		return $this->obj_class;
	}
	function setObjClass($value) {
		$this->obj_class = $value;
	}
	
	function getObjId() {
		return $this->obj_id;
	}
	function setObjId($value) {
		$this->obj_id = $value;
	}
	
	function getOrder() {
		return $this->order;
	}
	function setOrder($value) {
		$this->order = $value;
	}
	
	function setIssue(&$cat) {
		$this->forwardForeigns["Issue"]->setForeign($cat);
	}
	function &getIssue() {
		return $this->forwardForeigns["Issue"]->getForeign();
	}
	
	// restore
	function fillEntity($arrResult) {
		DbAbstractTable::fillEntity($arrResult);
		$this->setObjClass($arrResult[self::TB_O_CLASS]);
		$this->setObjId($arrResult[self::TB_O_ID]);
		$this->setOrder($arrResult[self::TB_ORDER]);
	}
	
	//store
	function fillFields() {
		DbAbstractTable::fillFields();
		$this->fildsForStore[self::TB_O_CLASS] = "'".$this->getObjClass()."'";
		$this->fildsForStore[self::TB_O_ID] = "'".$this->getObjId()."'";
		$this->fildsForStore[self::TB_ORDER] = $this->getOrder();		
	}
	
	// same for all classes
	public static function findAll() {return DbAbstractTable::findAll(self::CLASS_NAME);}
    public static function findById($id) {return DbAbstractTable::findById($id, self::CLASS_NAME);}
}
?>